gh-146632: make traceback handle illformed ModuleNotFoundError#146633
gh-146632: make traceback handle illformed ModuleNotFoundError#146633Locked-chess-official wants to merge 3 commits intopython:mainfrom
traceback handle illformed ModuleNotFoundError#146633Conversation
|
Hiya @Locked-chess-official, Shouldn't we add a regression test for this in btw the CI failure is an unrelated issue. Great fix :) |
| if entry.name.startswith(child + '.') and entry.name.endswith(untagged_suffix): | ||
| return entry.name | ||
| except Exception: | ||
| return |
There was a problem hiding this comment.
Ignoring silently exceptions sounds like a bad pattern. If you expect specific exceptions, use more precise except.
There was a problem hiding this comment.
Here is impossible to use precise except. It is in handling an exception, where raising another exception will cause the crash.
There was a problem hiding this comment.
In this case, I sugegst that we let the exception propagate. If this code path fails it's something we want to know.
| import importlib.machinery | ||
| import importlib.resources.readers | ||
|
|
||
| if not module_name or not importlib.machinery.EXTENSION_SUFFIXES: |
There was a problem hiding this comment.
We should keep not module_name test.
traceback handle illformed ModuleNotFoundError
| if entry.name.startswith(child + '.') and entry.name.endswith(untagged_suffix): | ||
| return entry.name | ||
| except Exception: | ||
| return |
There was a problem hiding this comment.
In this case, I sugegst that we let the exception propagate. If this code path fails it's something we want to know.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Uh oh!
There was an error while loading. Please reload this page.